package org.fh.service.exam.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.fh.entity.Page;
import org.fh.entity.PageData;
import org.fh.mapper.dsno1.exam.AchievementMapper;
import org.fh.service.exam.AchievementService;

/** 
 * 说明： 成绩管理接口实现类
 * 作者：FH Admin Q313596790
 * 官网：www.fhadmin.org
 * @version
 */
@Service
@Transactional //开启事物
public class AchievementServiceImpl implements AchievementService{

	@Autowired
	private AchievementMapper achievementMapper;
	
	/**新增
	 * @param pd
	 * @throws Exception
	 */
	public void save(PageData pd)throws Exception{
		achievementMapper.save(pd);
	}
	
	/**删除
	 * @param pd
	 * @throws Exception
	 */
	public void delete(PageData pd)throws Exception{
		achievementMapper.delete(pd);
	}
	
	/**修改
	 * @param pd
	 * @throws Exception
	 */
	public void edit(PageData pd)throws Exception{
		achievementMapper.edit(pd);
	}
	
	/**列表
	 * @param page
	 * @throws Exception
	 */
	public List<PageData> list(Page page)throws Exception{
		return achievementMapper.datalistPage(page);
	}
	
	/**列表(全部)
	 * @param pd
	 * @throws Exception
	 */
	public List<PageData> listAll(PageData pd)throws Exception{
		return achievementMapper.listAll(pd);
	}
	
	/**成绩排名
	 * @param pd
	 * @throws Exception
	 */
	public List<PageData> getRanking(PageData pd)throws Exception{
		return achievementMapper.getRanking(pd);
	}
	
	/**通过id获取数据
	 * @param pd
	 * @throws Exception
	 */
	public PageData findById(PageData pd)throws Exception{
		return achievementMapper.findById(pd);
	}
	
	/**批量删除
	 * @param ArrayDATA_IDS
	 * @throws Exception
	 */
	public void deleteAll(String[] ArrayDATA_IDS)throws Exception{
		achievementMapper.deleteAll(ArrayDATA_IDS);
	}

	@Transactional(rollbackFor = Exception.class)
	@Override
	public void updateBusUserExamRecords(PageData pd) throws Exception {
		achievementMapper.updateBusUserExamRecords(pd);
		achievementMapper.saveBusUserExamRecords(pd);
		achievementMapper.updateBusExamMakeup(pd);
	}

	@Override
	public PageData findByTestPHone(PageData pd) throws Exception {
		return achievementMapper.findByTestPHone(pd);
	}
}

